package com.ruoyi.celoan.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.celoan.entity.ExTradeEffectFinancingrequirementsDetailEntity;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface ExTradeEffectFinancingrequirementsDetailMapper extends BaseMapper<ExTradeEffectFinancingrequirementsDetailEntity> {

    @Select("SELECT " +
            "   m.credit_code AS unisc_id, " +
            "   m.enterprise_name, " +
            "   o.org_name AS bank_name, " +
            "   '' AS back_code, " +
            "   i.apply_amount_max AS amount, " +
            "   i.maturity_max AS maturity, " +
            "   i.create_time AS release_time, " +
            "   '企业经营' AS orientation, " +
            "   i.apply_state AS state, " +
            "   i.guarantee_type AS guarantee_mode, " +
            "   i.rate_max AS loan_rate, " +
            "   i.repayment_type AS repayment_ways, " +
            "   UUID_SHORT() AS external_system_id, " +
            "   '130400' AS area_code, " +
            "   i.create_time AS loan_time, " +
            "   0 AS isflag, " +
            "   '1306' AS platform_id, " +
            "   i.province_name AS province, " +
            "   i.city_name AS city, " +
            "   i.area_name AS area, " +
            "   0 AS deleted " +
            "FROM " +
            "   ec_enterprise_financing_info i " +
            "   LEFT JOIN ec_enterprise_information m ON m.id = i.enterprise_id " +
            "   INNER JOIN oc_financing_match fm ON fm.apply_id = i.apply_no " +
            "   INNER JOIN biz_organization o ON o.org_path = fm.org_path " +
            "   LEFT JOIN ex_trade_effect_financingrequirements_detail fd on fd.id = i.id " +
            "WHERE " +
            "   m.create_time >= DATE_FORMAT(CURDATE(), '%Y-%m-01') and fd.id is null")
    List<ExTradeEffectFinancingrequirementsDetailEntity> selectEnterpriseFinancingList();
}


/* Location:              D:\tuodayun\workspace\work\celoan-third-data-report-service-2.0.0-SNAPSHOT.jar!\BOOT-INF\classes\com\celoan\mapper\ExTradeEffectFinancingrequirementsDetailMapper.class
 * Java compiler version: 8 (52.0)
 * JD-Core Version:       1.1.3
 */
